package org.darkforest.enums;

/**
 * Created by valentina on 15/7/19.
 * 前后台需要在redis中同步的变量前缀
 */
public enum VariablePrefixEnum {

    MS_UPDATE_PRE("ms_update_"),                //秒杀相关变量前缀
    MS_USERS_PRE("ms_users_"),
    MS_VALIDAMT_PRE("ms_validAmt_"),
    QR_DIR_PRE("QR_code"),
    QR_URL_PRE("QR_url_");                      //阿里云二维码文件夹前缀

    private String key_pre;

    public String getKey_pre() {
        return key_pre;
    }


    private VariablePrefixEnum(String key_pre) {
        this.key_pre = key_pre;
    }

    public static VariablePrefixEnum getPerfixEnum(String key){
        VariablePrefixEnum prefixEnum = null;
        for(VariablePrefixEnum variablePrefixEnum : VariablePrefixEnum.values()){
            if(key!=null && variablePrefixEnum.getKey_pre().equals(key)){
                prefixEnum = variablePrefixEnum;
            }
        }
        return prefixEnum;
    }
}
